/* memcpy example */
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <stdlib.h>

using namespace std;
int main () {

    //  Inspired by http://cboard.cprogramming.com/c-programming/103663-int-char-array.html
    int number = 503;
    unsigned char charArray[4];
    bzero( charArray, 4 );
    memcpy( charArray, &number, 4 );
 
    int i;
    // Show values in the char array
    for( i = 0; i < 4; ++i ) {
        printf( "charArray[%d]: %02X\n", i,  ((int)charArray[i]) & 0xff);
    }
    return 0;
}

